---
sidebar_position: 5
---

import { TestFile } from '../../src/components/CustomSandpack';

# .toBeNil()

Use `.toBeNil` when checking a value is `null` or `undefined`.

<TestFile name="toBeNil">
  {`test('passes when value is null or undefined', () => {
  expect(null).toBeNil();
  expect(undefined).toBeNil();
  expect(true).not.toBeNil();
});`}
</TestFile>
